#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_clicked()
{
    QDateTime time_old=ui->dateTimeEdit_old->dateTime();
    QDateTime time_new=ui->dateTimeEdit_new->dateTime();
    int days=time_old.daysTo(time_new);

    int hours=(time_old.secsTo(time_new)/3600)%24;
     ui->label->setText(QString::number(days)+"天 零"+QString::number(hours)+"小时 分"
                        +QString::number((time_old.secsTo(time_new)/60)%60));
}
